package cn.jingsheng.backup.bean;

import cn.jingsheng.backup.Constants;

/**
 * 用户角色表
 * 
 * @author 李晓丹
 * 
 */
public class UserLogin {
	// 用户名
	private String userName;
	// 密码
	private String password;
	// 权限ID
	private int roleId;

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public int getRoleId() {
		return roleId;
	}

	public void setRoleId(int roleId) {
		this.roleId = roleId;
	}

	/**
	 * 查看权限
	 * 
	 * @return
	 */
	public boolean canView() {
		return (this.roleId & Constants.ROLE_VIEW) != 0;
	}

	/**
	 * 删除权限
	 * 
	 * @return
	 */
	public boolean canDelete() {
		return (this.roleId & Constants.ROLE_DELETE) != 0;
	}

	public boolean canDownload() {
		return (this.roleId & Constants.ROLE_DOWN) != 0;
	}

	public boolean canUpload() {
		return (this.roleId & Constants.ROLE_UPLOAD) != 0;
	}
}
